<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="UTF-8" />
        <link rel="stylesheet" href="styles/style.css">
        <link rel="stylesheet" href="styles/theme/atom-one-dark.css">
        <title>例子17-ES6/7常用语法介绍</title>
    </head>
    <body>
        <pre>
            <code>
                // 例子17

                function foo({x, y} = {x: 0, y: 0}) {
                    console.log(x, y);
                }

                foo({}) // undefined undefined
                foo({x: 1}) // 1 undefined
                foo({x: 1, y: 2}) // 1 2
                foo() // 0 0

                //--------------------------------------------------------------------------

                function foo({x = 0, y = 0} = {}) {
                    console.log(x, y);
                }

                foo({}) // 0 0
                foo({x: 1}) // 1 0
                foo({x: 1, y: 2}) // 1 2
                foo() // 0 0
            </code>
        </pre>
        <script src="scripts/libs/highlight.pack.js"></script>
        <script src="scripts/17.js"></script>
        <script>
            hljs.initHighlightingOnLoad();
        </script>
    </body>
</html>